package com.study.studyInstance;

public class TestChangeParameter {
    public static void main(String[] args) {
        Pig p = new Pig();
        p.show(10,200.43,true,false,true,false,true);
        //可变形参传入参数时，可以是0,1,多个。
        p.wuhu();
        p.wuhu(5);
        p.wuhu(2,34,34);
    }
}
class Pig{
    int age;
    double weight;
    boolean isMale;
    boolean isOverWeight;
    public void show(int a,double b,boolean...x){
        this.age = a;
        this.weight = b;
        for(int i = 0;i<x.length;i++){
            System.out.println(x[i]);
        }
        System.out.println(age+" "+weight);
    }
    //可变个数形参只能放在形参列表的最后
    public void wuhu(int...y){
        for(int i:y){
            System.out.println(i);
        }
    }
    public void wuhu(boolean a){
        System.out.println(a);
    }
}